<template>
	<view class="setting">
		<u-cell-group :border="false">
			<u-cell-item  @click="handlePersonalProfileClick">
				<view slot="title" class="setting-top">
					<u-avatar :src="src"></u-avatar>
					<view class="setting-top-personal-information">
						<view>king~</view>
						<view>微信号：ll1914131027</view>
					</view>
				</view>
			</u-cell-item>
		</u-cell-group>

		<view>
			<u-cell-group class="distance">
				<u-cell-item icon="coupon" title="服务" @click="handleSupportClick"></u-cell-item>
			</u-cell-group>
			<u-cell-group class="distance">
				<u-cell-item icon="bookmark" title="收藏"></u-cell-item>
				<u-cell-item icon="moments" title="朋友圈"></u-cell-item>
				<u-cell-item icon="integral-fill" title="公众号"></u-cell-item>
			</u-cell-group>
			<u-cell-group class="distance">
				<u-cell-item icon="setting-fill" title="设置" @click="handleSetttingClick"></u-cell-item>
			</u-cell-group>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				src: "https://cdn.uviewui.com/uview/example/fade.jpg",
			};
		},
		methods: {
			handlePersonalProfileClick() {
				uni.navigateTo({
					url: "/pages/setting/personalProfile/personalProfile",
				})
			},
			handleSupportClick(){
				
			},
			handleSetttingClick() {
				uni.navigateTo({
					url: "/pages/setting/settingDetail/settingDetail?key=10",
					success: function(res) {
						uni.$emit("setting", {
							datas: "你好啊"
						})
						// 通过eventChannel向被打开页面传送数据
						res.eventChannel.emit('acceptDataFromOpenerPage', {
							data: 'data from starter page'
						})
					}
				})
			}
		}
	};
</script>

<style lang="scss">
	.setting {
		background-color: #cfcfcf;

		.setting-top {
			display: flex;
			.setting-top-personal-information{
				display: flex;
				flex-direction:column;
				margin-left: 40rpx;
			}
			// justify-content: space-between;
			// background-color: #fff;
		}
	}

	.distance {
		margin-top: 10px;
	}
</style>